import { BasicColumn } from "/@/components/Table";
import { FormSchema } from "/@/components/Table";
import { render } from "/@/utils/common/renderUtils";

export const columns: BasicColumn[] = [
  { title: "方式", dataIndex: "sffs", width: 30,
    customRender:({text}) => {
      const color = text == '1' ? 'green' : 'blue';
      return render.renderTag(render.renderDict(text, 'sffsType'), color)
    }
  },
  { title: "订单编号", dataIndex: "orderId", width: 60, className: "text-red-500" },
  { title: "报销项目", dataIndex: "dwmc", width: 150, align: "left", },
  { title: "报销金额", dataIndex: "je", width: 40, align: "right", className: "text-green-500" },
  { title: "报销事则", dataIndex: "bz", width: 140, align: "left", },
  { title: "合并数", dataIndex: "num", width: 34 },
  { title: "录入日期", dataIndex: "createTime", width: 55, format: "date|YYYY-MM-DD" },
];

export const searchFormSchema: FormSchema[] = [
  {
    label: "录入日期",
    field: "createTime",
    component: 'DatePicker',
  },
  {
    label: "报销项目",
    field: "dwmc",
    component: "Input"
  }
];

export const formSchema: FormSchema[] = [
  // TODO 主键隐藏字段，目前写死为ID
  { label: "", field: "id", component: "Input", show: false },
  {
    label: "报销项目",
    field: "dwmc",
    component: "InputTextArea",
    labelWidth: 100,
    colProps: { span: 23 },
    componentProps: { readonly: true, autoSize: true },
  },
  {
    label: "订单号",
    field: "orderId",
    component: "Input",
    labelWidth: 100,
    colProps: { span: 18 },
    componentProps: { readonly: true },
  },
  {
    label: "笔数",
    field: "num",
    component: "InputNumber",
    labelWidth: 100,
    colProps: { span: 18 },
    componentProps: { readonly: true },
  },
  {
    label: "报销金额",
    field: "je",
    component: "Input",
    labelWidth: 100,
    colProps: { span: 18 },
    componentProps: { readonly: true },
  },
  {
    label: "报销事由",
    field: "bz",
    component: "InputTextArea",
    labelWidth: 100,
    colProps: { span: 23 },
    componentProps: { allowClear: false, rows:"9" },
  }
  //toolbar: ''
];
